package com.fanxuankai.boot.mqbroker;

import java.io.Serializable;
import java.util.Date;

/**
 * 事件
 *
 * @author fanxuankai
 */
public class Event<T> implements Serializable {
    /**
     * 分组
     */
    private String group;
    /**
     * 事件名
     */
    private String name;
    /**
     * 事件的 key，用于防重机制
     */
    private String key;
    /**
     * 数据 key
     * kafka: 目前用于 kafka key，默认为空
     */
    private String dataKey;
    /**
     * 数据
     */
    private T data;
    /**
     * 重试次数
     */
    private Integer retryCount;
    /**
     * 生效时间
     */
    private Date effectTime;

    public Event() {
    }

    public Event(String name, String key, String dataKey, T data, Integer retryCount, Date effectTime) {
        this.name = name;
        this.key = key;
        this.dataKey = dataKey;
        this.data = data;
        this.retryCount = retryCount;
        this.effectTime = effectTime;
    }

    public Event(String name, String key, T data, Integer retryCount, Date effectTime) {
        this.name = name;
        this.key = key;
        this.data = data;
        this.retryCount = retryCount;
        this.effectTime = effectTime;
    }

    public Event(String name, String key, String dataKey, T data, Date effectTime) {
        this.name = name;
        this.key = key;
        this.dataKey = dataKey;
        this.data = data;
        this.effectTime = effectTime;
    }

    public Event(String name, String key, T data, Date effectTime) {
        this.name = name;
        this.key = key;
        this.data = data;
        this.effectTime = effectTime;
    }

    public Event(String name, String key, String dataKey, T data) {
        this.name = name;
        this.key = key;
        this.dataKey = dataKey;
        this.data = data;
    }

    public Event(String name, String key, T data) {
        this.name = name;
        this.key = key;
        this.data = data;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getDataKey() {
        return dataKey;
    }

    public void setDataKey(String dataKey) {
        this.dataKey = dataKey;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public Integer getRetryCount() {
        return retryCount;
    }

    public void setRetryCount(Integer retryCount) {
        this.retryCount = retryCount;
    }

    public Date getEffectTime() {
        return effectTime;
    }

    public void setEffectTime(Date effectTime) {
        this.effectTime = effectTime;
    }
}
